package com.example.productservice.controller;

import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.example.productservice.entity.Product;
import org.springframework.http.ResponseEntity;

/**
 * @author lenovo
 * @Description
 * @Date2025/4/17 下午5:22
 */

//限流处理
public class ExceptionHandler {

    public static String handleHello(BlockException ex){
        return "这是hello接口被限流了";

    }

    public static ResponseEntity<Product> findProductByIdExcpetion(Integer id, BlockException ex) {
        Product product = new Product();
        product.setName("这是被限流的商品数据");
        return ResponseEntity.ok(product);
    }

}
